﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml;
using System.IO;
using System.Globalization;
using DocumentFormat.OpenXml.Validation;

namespace OOXMLValidation.Api
{
    public static class PackageValidator
    {
        public static bool Validate(OpenXmlPackage package, out List<ValidationErrorInfo> errors)
        {
            errors = new List<ValidationErrorInfo>();
            OpenXmlValidator ooxmlVal = new OpenXmlValidator(FileFormatVersions.Office2007); // 2010 not yet supported
            errors.AddRange(ooxmlVal.Validate(package));
            ValidationErrorInfo valError = new ValidationErrorInfo();
            return (errors.Count > 0);
        }
    }
}
